package com.ceair.flight.refund.location.dt.enums;

/**
 * 订单类型枚举
 *
 * @author rujun
 *
 */
public enum OrderTypeEnum {

    ORIGINAL_ORDER(1, "原始订单"),
    UPDATED_ORDER(2, "升舱订单"),
    RESCHEDULE_ORDER(3, "收费改期订单"),
    POINT_ORDER(4, "积分换票订单");

    /**
     * 简码
     */
    private final Integer code;

    /**
     * 描述
     */
    private final String description;

    private OrderTypeEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * @return Returns the code.
     */
    public Integer getCode() {
        return code;
    }

    /**
     * @return Returns the description.
     */
    public String getDescription() {
        return description;
    }

    /**
     * 通过枚举<code>code</code>获得枚举。
     *
     * @param code 简码
     * @return 枚举
     */
    public static OrderTypeEnum getByCode(Integer code) {
        for (OrderTypeEnum status : values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        return null;
    }
}
